package com.osgix.authorize.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.osgix.authorize.model.UserInfo;
import com.osgix.authorize.dao.UserInfoDao;
import com.osgix.authorize.service.UserInfoManager;
import com.osgix.common.orm.Page;
import com.osgix.common.orm.ibatis.EntityDao;
import com.osgix.common.service.BaseManager;
import com.osgix.common.service.AbsBaseManager;
import com.osgix.authorize.service.UserInfoManager;

import com.osgix.common.orm.ibatis.BaseIbatisDao;
import org.springframework.stereotype.Repository;

@Service("userInfoManager")
@Transactional
public class UserInfoManagerImpl extends AbsBaseManager<UserInfo,Long> implements UserInfoManager{

	private UserInfoDao userInfoDao;
	
	/**增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,请注意大小写*/
	@Resource
	public void setUserInfoDao(UserInfoDao dao) {
		this.userInfoDao = dao;
	}
	
	public EntityDao getEntityDao() {
		return this.userInfoDao;
	}
	
	public void saveUserInfo(UserInfo userInfo) throws RuntimeException {
		userInfoDao.save(userInfo);
	}
	
	public void updateUserInfo(UserInfo userInfo) {
		userInfoDao.update(userInfo);
	}
	
	public int deleteByLoginAccount(java.lang.String loginAccount){
		return userInfoDao.deleteByLoginAccount(loginAccount);
	}
	
	public int deleteByLoginEmail(java.lang.String loginEmail){
		return userInfoDao.deleteByLoginEmail(loginEmail);
	}
	
	
	@Transactional(readOnly=true)
	public UserInfo getByLoginAccount(java.lang.String loginAccount) {
		return userInfoDao.getByLoginAccount(loginAccount);
	}
	
	@Transactional(readOnly=true)
	public UserInfo getByLoginEmail(java.lang.String loginEmail) {
		return userInfoDao.getByLoginEmail(loginEmail);
	}
	
}
